package cn.kfm666.data.structure.sort;

import cn.kfm666.data.structure.util.GenerateData;

import java.util.Arrays;
import java.util.Scanner;

public class BubbleSortCompare {
    public static void main(String[] args) {
        BubbleSortPlus sortPlus = new BubbleSortPlus();
        BubbleSort sort = new BubbleSort();
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("please input data size:");
//        int size = scanner.nextInt();
//        int[] data = GenerateData.generateIntArray(size,100);
//        System.out.println("初始数据："+Arrays.toString(data));
        int simple = 10;
        for(int i = 1;i<=5;i++){
            Double size1 = Math.pow(simple,i);
            int size = size1.intValue();
            int[] data = GenerateData.generateIntArray(size,1000000);
            System.out.println("size："+size);
            long start,end;
            start = System.currentTimeMillis();
            sort.sort(data,size);
            end = System.currentTimeMillis();
            System.out.print("冒泡法用时："+(end-start));
            start = System.currentTimeMillis();
            sort.sort(data,size);
            end = System.currentTimeMillis();
            System.out.println("，鸡尾酒用时："+(end-start));
        }
    }
}
